<?php

namespace App\Http\Controllers\Admin;

use app\Logic\Layui\Service\AdminLogout;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\DB;

class IndexController extends Controller
{
    use CallController;

    private function index(Request $request)
    {
        $admin = DB::table('admin_user')->where(['id'=>session('adminId')])->first();

        $app = $this->factory->Menu($request);
        $menu = $app->menu();

        return view('Admin.Index.index', ['admin' => $admin , 'menu' => $menu]);
    }

    public function console()
    {
        return view('Admin.Index.console');
    }


    public function logout()
    {
        return $this->factory->AdminUser(function ($app){
            return new AdminLogout($app);
        })->logout();
    }
}